#ifndef DYN_ODE_SIFS2_H
#define DYN_ODE_SIFS2_H

#include "dyn_ode_si.h"

/*! \brief Symplectic integrator with fixed stepsize of order 2.
 *
 * We implement the optimal second-order
 * symplectic integrator. We have taken
 * our values from Poulin (1997), which in turn
 * has taken them from McLachlan and Atela (1992).
 *
 * This integrator only works with Hamiltonians of the
 * form
 *  \f[ H(\mathbf{q},\mathbf{p}) = T(\mathbf{p})+V(\mathbf{q}), \f]
 * i.e., separable Hamiltonians.
 */

class SIFS2 : public SI
{
public:
    /*! Same as base constructor. */
    SIFS2(HamiltonianSystem& func,
          colvec _initCond,
          double _end,
          double _initStepsize)
        : SI(func,_initCond,_end,_initStepsize), M(2), order(2){}


protected:
    /*! @name Coefficients of the expansion. */
    //@{
    const double c1 = 1.0/sqrt(2.0);
    const double c2 = 1.0-c1;
    const double d1 = 1.0-1.0/sqrt(2.0);
    const double d2 = 1.0-d1;

    const colvec c = {c1,c2};
    const colvec d = {d1,d2};
    //@}
};

#endif // DYN_ODE_SIFS2_H
